/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Paul
 */
import java.awt.Color;
import java.awt.Component;
  import javax.swing.JTable;
  import javax.swing.JTextArea;
  import javax.swing.table.TableCellRenderer;

  public class TextAreaRenderer extends JTextArea
      implements TableCellRenderer {

    public TextAreaRenderer() {
      setLineWrap(true);
      setWrapStyleWord(true);
    }

    public Component getTableCellRendererComponent(JTable jTable,
        Object obj, boolean isSelected, boolean hasFocus, int row,
        int column) {
      setText((String)obj);

      if(hasFocus){
        this.setBackground(new Color(186, 255, 255));
      }

      if(hasFocus == false){
          this.setBackground(Color.WHITE);
      }

      return this;
    }
  }